import Mock from 'mockjs';
import { baseApi } from '@/server/base'
import { getBodyParams, getUrlParams } from '@/mock/utils';

import { TagInfo } from '@/apis/tag';


export default [
  {
    url: /\/apis\/label\/list\/.*\/.*/,
    type: 'get',
    response: (params?: any) => {

      const { current, size } = getUrlParams(params.url);

      return Mock.mock({
        code: 1,
        data: {
          current: + current,
          size: +size,
          total: 100,
          pageTotal: 10,
          'data|20': [
            {
              id: '@id',
              name: '@word(5)',
              colour: '@color',
              createTime: '@datetime',
            }
          ]
        },
        msg: ''
      })
    }
  },
  // {
  //   url: /\/apis\/label\/removeById\/.*/,
  //   type: 'delete',
  //   response: (params: any) => {
  //     const { id } = getUrlParams(params.url);
  //     return Mock.mock({

  //       code: 1,
  //       data: {
  //         id,
  //         name: '@word(5)',
  //         colour: '@color',
  //         createTime: '@datetime',
  //       },
  //       msg: ''
  //     })
  //   }
  // },
  {

    url: `${baseApi}/tag/save`,

    type: 'post',
    response: (params: any) => {
      const _params = getBodyParams(params.body);
      return Mock.mock({

        code: 1,
        data: _params,
        msg: ''
      })
    }
  },
  {
    url: `${baseApi}/tag/update`,
    type: 'put',
    response: (params: any) => {
      const _params = getBodyParams(params.body);
      return Mock.mock({
        code: 1,
        data: _params,
        msg: ''
      })
    }
  }
]
